<template>
	<view class="main">
		<view class="title">
			<text class="title-first">添加银行卡</text>
			<text class="title-explain">翔瑞金融钱包保障您的信息安全</text>
		</view>
		<view class="bankCardTitle">
			<text class="bank-title">银行卡号</text>
			<text class="bank-explain">支持的银行</text>
		</view>

		<view class="bankNumber">
			<input type="text" placeholder="请输入你的银行卡号" class="bankInput" v-model="bankCardId" />
			<image src="../../static/financialImg/bankWen.png" class="bankImg"></image>
		</view>
		<linkHr></linkHr>
		<view class="bank-btn" @tap="verifyBankCard()">
			<image src="../../static/financialImg/bank_yanzheng.png" mode="" class="bank_yanzheng"></image>
			<text class="btn-title"> 验证银行卡卡号 </text>
		</view>
		<view class="recommend-choose"> 推荐选择 </view>
		<view class="footer">
			<view class="footer-title">
				<text class="title-first">快速绑卡,无需手动输入卡号</text>
				<text class="title-explain">已和以下银行合作</text>
			</view>
			<linkHr></linkHr>

			<view class="li" v-for="(item, index) in bankCard" :key="index" @tap="choicBankcard(item)">
				<image :src="item.logo" mode="" class="bank_ico"></image>
				<text class="bank_name">{{ item.name }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import linkHr from "../../components/linkHr/linkHr.vue";
	export default {
		components: {
			linkHr,
		},
		data() {
			return {
				bankCard: [{
						_id: 1,
						name: "中国建设银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUgAHI.png",
						state: 0,
					},
					{
						_id: 2,
						name: "中国农业银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUhgjU.png",
						state: 0,
					},
					{
						_id: 3,
						name: "浦发银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUh5NR.png",
						state: 0,
					},
					{
						_id: 4,
						name: "中国银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUh736.png",
						state: 0,
					},
					{
						_id: 5,
						name: "中国邮政银行",
						logo: "https://z3.ax1x.com/2021/04/09/cUhvEd.png",
						state: 0,
					},
				],
				bankCardId: ``
			};
		},

		methods: {
			verifyBankCard() {
				if (this.bankCardId) {
					uni.showLoading({
						title: "正在验证"
					})
					setTimeout(() => {
						uni.hideLoading()
						uni.navigateTo({
							url: `../verifyBank/verifyBank?msg=${JSON.stringify(this.bankCard[0])}`
						})
					}, 2000)
				} else {
					uni.showToast({
						title: "银行卡号不正确",
						icon: "none"
					})
				}
			},

			choicBankcard(e) {
				uni.navigateTo({
					url: `../verifyBank/verifyBank?msg=${JSON.stringify(e)}`
				})
			}
		},
		onLoad(option) {
			
			uni.setNavigationBarTitle({
				title: '绑定银行卡',
			});
		},
	};
</script>

<style scoped lang="scss">
	$font-color: #999999;
	$font-size: 24rpx;
	$font-size-ctn: 28rpx;
	$title-font-size: 48rpx;
	$border-raduis: 10rpx;

	@mixin fontSize {
		font-size: 28rpx;
		color: #333;
	}

	@mixin border {
		border: 1px solid red;
	}

	@mixin flexRow {
		display: flex;
		align-items: center;
	}

	@mixin flexCol {
		display: flex;
		flex-direction: column;
	}

	@mixin border-shadow {
		box-shadow: 0 0 16rpx 0rpx rgba(0, 0, 0, 0.15);
	}

	.main {
		padding: 0 40rpx 40rpx 40rpx;

		.title {
			@include flexCol();
			margin: 70rpx 0 70rpx 0;

			.title-first {
				font-size: 40rpx;
				color: #333;
				font-weight: bold;
				margin-bottom: 24rpx;
				// @include border();
			}

			.title-explain {
				font-size: 28rpx;
				color: #999;
			}
		}

		.bankCardTitle {
			// @include border();
			@include flexRow();
			justify-content: space-between;
			font-size: 28rpx;
			color: #333;
			margin-bottom: 20rpx;
		}

		.bankNumber {
			@include flexRow();
			justify-content: space-between;
			font-size: 32rpx;
			// margin-bottom: 40rpx;

			// @include border();
			.bankImg {
				width: 32rpx;
				height: 32rpx;
			}

			.bankInput {
				padding: 20rpx 0;
			}
		}

		.bank-btn {
			display: flex;
			justify-content: center;
			align-items: center;
			width: 100%;
			height: 88rpx;
			font-size: 28rpx;
			color: #fff;
			background-color: #3476f1;
			border-radius: 12rpx;
			margin-top: 40rpx;

			// @include border();
			.bank_yanzheng {
				position: relative;
				top: 2rpx;
				width: 28rpx;
				height: 28rpx;
				margin-right: 10rpx;
			}
		}

		.recommend-choose {
			margin: 40rpx 0;
			@include fontSize();
			// @include border();
		}

		.footer {
			@include flexCol();
			position: relative;
			padding: 40rpx;
			@include border-shadow();

			.footer-title {
				@include flexCol();

				.title-first {
					font-size: 32rpx;
					color: #333;
					font-weight: bold;
				}

				.title-explain {
					font-size: 28rpx;
					color: #999;
					margin-top: 12rpx;
					margin-bottom: 30rpx;
					// @include border();
				}
			}

			.li {
				// margin-top: 40rpx;
				@include flexRow();
				padding: 40rpx 0;
				border-bottom: 1rpx solid rgba(0, 0, 0, 0.08);
				font-size: 32rpx;
				color: #333;
				font-weight: bold;

				.bank_ico {
					position: relative;
					top: 2rpx;
					width: 30rpx;
					height: 30rpx;
					margin: 20rpx;
				}
			}

			.li::after {
				content: ">";
				position: absolute;
				right: 40rpx;
				color: #999;
			}
		}
	}
</style>
